public class Solution680 {
    public boolean validPalindrome(String s) {
        for (int l=0,r=s.length()-1;l<r;l++,r--){
            if (s.charAt(l)!=s.charAt(r)){
                return judge(s,l+1,r) || judge(s,l,r-1);
            }
        }
        return true;
    }

    private boolean judge(String s, int left, int right) {
        for (int l=left,r=right;l<r;l++,r--){
            if (s.charAt(l)!=s.charAt(r)){
                return false;
            }
        }
        return true;
    }

    public static void main(String[] args) {
        System.out.println(new Solution680().validPalindrome("abca"));
    }
}
